<?php namespace App;

use App\Moloquent;

class Package extends Moloquent {
    protected $collection = 'packages';
    public $timestamps = false;
    protected $fillable = array(
        'package_id', 
        'package_name'
    );
    
    /**
     * Get List Package
     *
     * @param int $artistId
     * @return array
     * @author Thang Phan
     */
    public static function getListPackage(){
        return Package::all()->toArray();
    }
    
    /**
     * Create Package
     *
     * @param int $artistId
     * @return array
     * @author Thang Phan
     */
    public static function createPackage(){
        
        /*$user = new Package;
        $user->name = 'John';
        $user->save();*/
        $package = Package::create(array(
            'package_id' => 5,
            'package_name' => 'Tom'
            ));
        return $package;
    }
    
    /**
     * Get Detail Package
     *
     * @param int $id
     * @return array
     * @author Thang Phan
     */
    public static function getPackageDetail($id){
        
        $id = intval($id);        
        $package = Package::where('package_id', $id)->first()->toArray();
        return $package;
    }

}
